The Xrules system is a rule based system. It uses "if-then" production rules and facts to represent knowledge. In addition to rules and facts, you may also declare and use HyperTalk globals in the rule base. As you will see, the language for the rule base is very similar to HyperTalk.
In the following discussions, we will use a simple Backus-Naur Form (BNF) to describe the language constructs. The following defines the notational conventions that will be used for the BNF:
- items in all caps represent keywords (GLOBAL, FACT, etc.)
- items in all small letters represent some string or
construct (operand, fact_id, conditionals, etc.).
| - indicates either-or of items on either side of the bar
{ } - items within the braces may be repeated 0 to n times
[ ] - items within the brackets are optional
Keywords and special characters may not be used as identifiers or strings unless they are enclosed in quotation marks (quotation marks may not be used in quoted strings other than to delimit the string). The keywords are:
AND CARD DAEMON ELSE END
FACT FALSE GLOBAL GO IF
INTO NOT OR PUT RULE
THEN TO TRUE WHEN
Special characters used by Xrules include:
equal sign (=) quotation marks (") comma (,)
period (.) pound sign (#) asterisk (*)
minus (-) left parentheses (() right parentheses ())
space ( ) question mark (?) left angle bracket (<)
right angle bracket (>)
Other characters permitted in quoted strings and identifiers include:
exclamation mark (!) at sign (@) dollar sign ($)
percent (%) up flex (^) ampersand (&)
plus (+) left brace ({) right brace (})
left bracket ([) right bracket (]) bar (|)
colon (:) semicolon (;) single quote (')
slash (/) tilde (~)
Characters permitted in strings and identifiers without quotes include the following:
Upper and lower case alpha characters
Numerals (as long as they are not the first character in the string or
identifier)
The underscore (_) character
In the BNF, strings without quotes are referred to as "simple_string". Quoted strings are referred to as "quoted_string".
Control characters such as tab and carriage return and characters not mentioned above may not be used in strings or identifiers whether quoted or not.